package inject

import (
	bucketService "gitee.com/kordar/bucket/service"
	"gitee.com/kordar/goadmin/admin/service"
	digstarter "github.com/kordar/dig-starter"
	"github.com/kordar/gocrud"
	"labelsys/dataset/service/impl"
)

func ServiceProvider() {

	digstarter.ProvideE(func(db DatasetDB, dictService service.DictService, bucketService bucketService.BucketService) (ServiceResult, error) {
		datasetServiceImpl := impl.NewDatasetService(db.DB, dictService)
		datasetImageServiceImpl := impl.NewDatasetImageService(db.DB, dictService)
		datasetLabelServiceImpl := impl.NewDatasetLabelService(db.DB, dictService)
		datasetUploadServiceImpl := impl.NewDatasetUploadServiceImpl(db.DB, bucketService, dictService)
		return ServiceResult{
			DatasetService:       datasetServiceImpl,
			DatasetUploadService: datasetUploadServiceImpl,
			ResourceService: []gocrud.ResourceService{
				datasetServiceImpl,
				datasetImageServiceImpl,
				datasetLabelServiceImpl,
			},
		}, nil
	})

}
